package com.cosina.game.robodefence.core;

import com.cosina.game.robodefence.data.WaveData;

public class WaveManager {
	int waveDataIndex;
	final int[] waveData;
	
	public WaveManager(int mapId){
		waveData = WaveData.getData(mapId);
	}
	
	private Wave nextWave =  new Wave();
	
	public Wave getNextWave(){
		if(waveDataIndex >= waveData.length)
			return null;
		
		while(true){
			int kind = waveData[waveDataIndex];
			int count = waveData[waveDataIndex + 1];
			nextWave.add(kind, count, 0);
			waveDataIndex += 2;
			
			if(waveData[waveDataIndex] == -1){
				waveDataIndex++;
				break;
			}
		}
		
		return nextWave;
	}
}
